﻿using Sql_Dataprovider;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Phim
{
    public class Phim
    {

        private int _MaPhim;
        public int MaPhim
        {
            get { return _MaPhim; }
            set { _MaPhim = value; }
        }


        private string _TenPhim;
        public string TenPhim
        {
            get { return _TenPhim; }
            set { _TenPhim = value; }
        }


        private string _NuocSanXuat;
        public string NuocSanXuat
        {
            get { return _NuocSanXuat; }
            set { _NuocSanXuat = value; }
        }


        private string _HangPhim;
        public string HangPhim
        {
            get { return _HangPhim; }
            set { _HangPhim = value; }
        }


        private string _GioiThieuPhim;
        public string GioiThieuPhim
        {
            get { return _GioiThieuPhim; }
            set { _GioiThieuPhim = value; }
        }


        private string _Trailer;
        public string Trailer
        {
            get { return _Trailer; }
            set { _Trailer = value; }
        }


        private string _Poster;
        public string Poster
        {
            get { return _Poster; }
            set { _Poster = value; }
        }


        private int _MaDinhDang;
        public int MaDinhDang
        {
            get { return _MaDinhDang; }
            set { _MaDinhDang = value; }
        }
    }

    public class Phim_DAO
    {
        public Boolean Them_Phim(Phim NEWS)
        {
            Sql_DataProvider INS = new Sql_DataProvider();
            string sql = string.Format("exec Insert_Phim N'{0}', N'{1}', N'{2}',N'{3}',N'{4}',N'{5}',{6}", NEWS.TenPhim, NEWS.NuocSanXuat, NEWS.HangPhim, NEWS.GioiThieuPhim, NEWS.Trailer, NEWS.Poster, NEWS.MaDinhDang);
            if(INS.SQL_ExecuteNonQuery(sql) != 0)
            {
                return true;

            }else{return false;}
        }

        public Boolean Xoa_Phim(int MaPhim)
        { 
            Sql_DataProvider DELS = new Sql_DataProvider();
            string sql = string.Format("exec Delete_Phim {0}", MaPhim.ToString());
            if(DELS.SQL_ExecuteNonQuery(sql) != 0)
            {
                return true;
            }
            return false;
        }

    }
}
